feat: add per-resource label selector support#2922
Conversation
|
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: superbrothers The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
0d4ee03 to
b6ce71e
Compare
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
b6ce71e to
7bea0e9
Compare
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
This PR adds per-resource label selector support for built-in resources in kube-state-metrics.
Users can now repeat
--label-selectorto scope individual resources by Kubernetes label selector, for example:This allows KSM to reduce the watched and exposed object set for selected resources, which is useful for tenant isolation, sharding, and reducing API server / memory usage.
Compared to the original proposal in #2885, this PR intentionally changes the CLI shape:
This PR supports built-in resources only. Custom resource metrics are not changed by this PR.
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Does not increase cardinality. For filtered resources, it can reduce the number of exposed series by reducing the set of watched objects.
Which issue(s) this PR fixes: (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged)Closes #2885